<template>
  <sweet-button @click="open1">可自动关闭</sweet-button>
  <sweet-button @click="open2">不会自动关闭</sweet-button>
</template>

<script setup>
import { getCurrentInstance} from "vue";
const { $sweetNotify } = getCurrentInstance().proxy
const open1 = () => {
  $sweetNotify({
    title: '标题名称',
    message: '这是一条会自动关闭的消息',
    namespace: 'sweet',
    type: 'warning'
  });
};

const open2 = () => {
  $sweetNotify({
    title: '提示',
    message: '这是一条不会自动关闭的消息',
    namespace: 'sweet',
    type: 'warning',
    duration: 0
  });
}
</script>
